<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击</button>
    <button>点击</button>
    <button>点击</button>
</body>
<script>
    var btn =document.querySelectorAll("button");
    for(let i=0 ;i<btn.length;i++){
        btn[i].addEventListener('click',function(){
            this.disabled= true;
            setTimeout(function(){
                this.disabled =false;
            }.bind(this),3000);     //利用bind()改变this的指向，使定时器里面的this在执行函数时指向定时器而不是window
        })
    }
</script>
</html>